from moviepy.video.io.VideoFileClip import VideoFileClip
# 或者也可以直接从utils导入get_video_info
# from utils import get_video_info


def get_video_info_processor(video_path, **kwargs):
    """获取视频信息的处理函数"""
    video = VideoFileClip(video_path)
    info = {
        "duration": video.duration,
        "size": video.size,
        "fps": video.fps,
        "audio_codec": video.audio.reader.codec if video.audio and hasattr(video.audio.reader, 'codec') else None,
        "video_codec": video.reader.codec if hasattr(video.reader, 'codec') else None
    }
    video.close()
    return info